<template>
  <el-dialog
    title="发件人信息"
    :modal="false"
    :visible.sync="centerDialogVisible"
    width="50%"
    center
  >
    <el-card class="margin-top">
      <el-form size="mini" label-position="left" label-width="98px">
        <el-button
          type="success"
          size="mini"
          class="header-save-btn" style="margin-top: 62px;margin-right: 20px"
          @click="changeSenderInfo"
        >
         保存
        </el-button>
        <el-row class="" :gutter="20">
          <el-col :span="12">
            <el-form-item prop="senderCompany">
              <div slot="label">发件人:</div>
              <el-input
                v-model="senderInfo.senderCompany"
                clearable
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item prop="senderPhone">
              <div slot="label">电话:</div>

              <el-input
                v-model="senderInfo.senderPhone"
                clearable
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item prop="senderLinkMan">
              <div slot="label">联系人:</div>

              <el-input
                v-model="senderInfo.senderLinkMan"
                clearable
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item prop="senderAdress">
              <div slot="label">详细地址:</div>

              <el-input
                v-model="senderInfo.senderAdress"
                clearable
              />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-card>
  </el-dialog>
</template>

<script>
import { ajax } from "@/store/yg/common/utils";
    export default {
      props: {
        data: {
          type: Object,
          default: function() {
            return {};
          }
        }
      },
      data() {
        return {
          centerDialogVisible: false,
          senderInfo: {
            id: 0,
            senderCompany: "Jack", // 发件人
            senderLinkMan: "Jack", // 联系人：
            senderPhone: 13544446666, // 联系电话：
            senderAdress: "Jack" // 详细地址：
          },
        };
      },
      mounted() {
        this.initData();
      },
      methods: {
        //数据初始化
        initData(){
          this.senderInfo = this.data;
        },
        changeSenderInfo() {
          console.log(11111)
            this.senderInfo["id"] = this.data.id;
            this.senderInfo["orderFlag"]=1;
            var param = this.senderInfo;
            ajax("changeSenderInfo", param).then(
              res => {
                if (res.code != 200) {
                  if (null != res.message) {
                    this.$message.error(m(res.message));
                  } else {
                    this.$message.error("修改失败!");
                  }
                } else {
                  this.$message.success("已提交到待审批列表");
                  this.forecastForm = res.data;
                  this.stockInfo = res.data;
                }
              },
              error => {
                console.log(error);
              }
            );
        },

      },
    }
</script>

<style scoped>

</style>
